package com.csun.cmny.provider.dto;

import com.csun.cmny.provider.validator.OmcConvertAddValidator;
import com.csun.cmny.provider.validator.OmcGiftAddValidator;
import com.csun.cmny.provider.validator.OmcGiftEditValidator;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * @Auther: chisj chisj@foxmal.com
 * @Date: 2019-05-20 13:26
 * @Description: the class gift dto
 */
@Data
public class GiftDto implements Serializable {

    private static final long serialVersionUID = -2471535127323631202L;

    /**
     * 礼品Id
     */
    @NotNull(message = "{gift.id.null}",
            groups = {OmcGiftEditValidator.class})
    private Long id;

    /**
     * 礼品编号
     */
    @NotNull(message = "{gift.no.null}",
            groups = {OmcGiftAddValidator.class})
    @NotEmpty(message = "{gift.no.null}",
            groups = {OmcGiftAddValidator.class})
    private String giftNo;

    /**
     * 礼品名称
     */
    @NotNull(message = "{gift.name.null}",
            groups = {OmcGiftAddValidator.class})
    @NotEmpty(message = "{gift.name.null}",
            groups = {OmcGiftAddValidator.class})
    private String giftName;

    /**
     * 礼品图片
     */
    @NotNull(message = "{gift.pic.null}",
            groups = {OmcGiftAddValidator.class})
    private Long giftPic;

    /**
     * 礼品价格
     */
    @NotNull(message = "{gift.price.null}",
            groups = {OmcGiftAddValidator.class})
    private BigDecimal price;

    /**
     * 兑换需要的积分
     */
    @NotNull(message = "{gift.integral.null}",
            groups = {OmcGiftAddValidator.class})
    private Integer integral;

    /**
     * 库存
     */
    @NotNull(message = "{gift.stock.null}",
            groups = {OmcGiftAddValidator.class})
    private Integer stock;

    /**
     * 是否上架 0-不上架 1-上架
     */
    @NotNull(message = "{gift.shelf.null}",
            groups = {OmcGiftAddValidator.class})
    @Range(min = 0, max = 1, message = "{gift.shelf.range}",
            groups = {OmcGiftAddValidator.class, OmcGiftEditValidator.class})
    private Integer shelf;

    /**
     * 是否需要发货 0-不需要 1-需要
     */
    @NotNull(message = "{gift.send.null}",
            groups = {OmcGiftAddValidator.class})
    @Range(min = 0, max = 1, message = "{gift.send.range}",
            groups = {OmcGiftAddValidator.class, OmcGiftEditValidator.class})
    private Integer send;

    /**
     * 开始时间
     */
    @NotNull(message = "{gift.period.start.null}",
            groups = {OmcGiftAddValidator.class})
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date periodStart;

    /**
     * 结束时间
     */
    @NotNull(message = "{gift.period.end.null}",
            groups = {OmcGiftAddValidator.class})
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date periodEnd;

    /**
     * 备注
     */
    private String remark;

    /**
     * 组织Id
     */
    private Long groupId;
}
